package dunshan.textdemo

import io.gatling.core.Predef._
import io.gatling.core.scenario.Simulation
import io.gatling.http.Predef._


class JsonSiuDeom extends Simulation {

  val httpConf = http.baseUrl("http://127.0.0.1:8080")
  //注意这里,设置提交内容type
  val headers_json = Map("Content-Type" -> "application/json")
  val scn = scenario("jsonScenario")
    .exec(http("test_json") //http 请求name
      .post("/login/json") //post url
      .headers(headers_json) //设置body数据格式
      //将json参数用StringBody包起,并作为参数传递给function body()
      .body(StringBody("{\"userName\": \"7d\", \"passWord\": 123456}")))
  setUp(scn.inject(atOnceUsers(10))).protocols(httpConf)

}
